<%@page import="java.util.*" %>
<%
	if(session.getAttribute("hotelId") != null)
	{
		Long hotelId = (Long)session.getAttribute("hotelId");
		Long userId = (Long)session.getAttribute("userid");
		Long xWorkArea = (Long)session.getAttribute("workArea");
		Long xCounter = (Long)session.getAttribute("counter");
		String xPageType = (String)session.getAttribute("pageType");
		if(hotelId != 0 && userId != null && xPageType != null && xCounter != null){
			if(xPageType.equals("F")){
				response.sendRedirect("task.jsp"); 
			}else if(xPageType.equals("A")){
				response.sendRedirect("/adminconsole/"); 
			}else if(xPageType.equals("H")){
				response.sendRedirect("/HouseKeeping/"); 
			}else if(xPageType.equals("P")){
				response.sendRedirect("/POS/"); 
			}
		}else if(hotelId == 0 && userId == null && xWorkArea == null){
			response.sendRedirect("/index.jsp");
		}
	}
%>

<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Login | Eem tech soft</title>
		<link href="/css/components/login/login.css" rel="stylesheet" />
		<link href="/css/ChoseCounter/SharedCssOnlyClass.css" rel="stylesheet" />
		<link href="/css/components/blocked/popup/popup.css" rel="stylesheet" />
		<link href="css/custom/jquery-ui-1.9.1.custom.css" rel="stylesheet" />
		<link href="/css/components/blocked/popup/popup.css" rel="stylesheet" />
		<link href="css/components/login/login-box.css" rel="stylesheet" />
		<link href="css/custom/loading.css" rel="stylesheet" />

		<script src="/js/jquery-1.8.3.min.js"></script>
		<script src="/js/jquery-ui-1.9.1.custom.min.js"></script>
		<script src="/js/components/login/login.js"></script>
		<script src="/js/loading.js"></script>
		<script src="/js/simpleservice.js"></script>
	</head>

	<SCRIPT TYPE="text/javascript">
		function submitenter(myfield,e)
		{
			var keycode;
			if (window.event) keycode = window.event.keyCode;
			else if (e) keycode = e.which;
			else return true;

			if (keycode == 13)
			{
				login();
				return false;
			}
			else
				return true;
		}
		function parseDateTime(e){var t=e.split(" ")[1].split(":");var n=$.datepicker.parseDate("yy-mm-dd",e.split(" ")[0]);n.setHours(t[0]);n.setMinutes(t[1]);n.setSeconds(t[2]);return n}
	</SCRIPT>

	<body >
		<div class="header">
			<div id="emm_logo">
				<img src="images/LogIn/eem_logo.gif">
			</div>
		</div>
		<div class="content">
			<div id="login_form">
				<table id="table_login_form">
				  <tr>
					<td>
						<div id="sign_in"><img src="images/LogIn/lock_icon.gif" style="vertical-align:middle"> Sign In</div>
						<input class="textbox" type="text" id="hotel_id" onkeypress="return submitenter(this,event)" placeholder="Hotel Code" value="1"/>
						<input class="textbox" type="text" id="email" onkeypress="return submitenter(this,event)" placeholder="E-mail Address" value="jesus.way@hotmail.com"/>
						<input class="textbox" type="password" id="pass" onkeypress="return submitenter(this,event)" placeholder="Password" value="opensource"/>
						<input name="" type="checkbox" value="" /><span>Keep me logged in</span>
					</td>
				  </tr>
				  <tr>
					<td style="float:right;">
						<input type="button" id="button" value="LOG IN" onClick="login()" />
					</td>
				  </tr>
			  </table>
			</div>
			<div id="helper">
				<div style="float:right">Forgot password? <span class="link">Recover Here</span> </br>Not registered yet? <span class="link">Register Here</span> </div>
			</div>
		</div>
		<div class="footer">
			<table style="width:100%;text-align:center">
				<tr>
					<td style="width:60%;text-align:left">Coppyright EEM Tech Soft co., Itd.</td>
					<td><span class="link">EEM Info</span></td>
					<td>|</td>
					<td><span class="link">Site Map</span></td>
					<td>|</td>
					<td><span class="link">Term Of Use</span></td>
					<td>|</td>
					<td><span class="link">Help Center</span></td>
					<td>|</td>
					<td><span class="link">Contact Us</span></td>
					<td>|</td>
					<td><span class="link">Select Language <img src="/images/LogIn/language-eng.gif" style="vertical-align:middle"></span></td>
				</tr>
			</table>
		</div>
		<div id="loginFail" title="Login Incorrect" style="display:none">
			<p>
				Please check your HotelId E-mail and Password
			</p>
		</div>
		<div id="loginShort" title="Frist Login" style="display:none">
			<p>
				Please use full hotelId from manager
			</p>
		</div>
		<div id="loginTimeout" title="Timeout" style="display:none">
			<p>
				Connection Timeout.
			</p>
		</div>
		<div id="loadingScreen"></div>
	</body>
</html>